﻿/**
 * @author wenglin.tw
 */
var oH4 = document.getElementsByTagName('h4');
for (var i = 0, len = oH4.length; i < len; i++) {
    oH4[i].index = i;
    oH4[i].onclick = function(e){
        e = window.event || e;
        var oEvent = e.srcElement ? e.srcElement : e.target;
	var index= Number(oEvent.index)+1;
        var oNext = YAHOO.util.Dom.getNextSibling('h4' + index+ '');
        var OFold = TB.widget.FoldingList.decorate(oNext, {
            multiExpand: false
        });
        OFold.collapseAll();
        var bNext = YAHOO.util.Dom.hasClass(oNext, 'hide');
        if (bNext) {
            YAHOO.util.Dom.removeClass(oNext, 'hide');
            YAHOO.util.Dom.addClass(oNext, 'show');
        }
        else {
            YAHOO.util.Dom.removeClass(oNext, 'show');
            YAHOO.util.Dom.addClass(oNext, 'hide');
        }
        
    }
}
